home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ohlutil.zip / MAKEFILE < prev    next >
Text File  |  1990-06-23  |  8KB  |  233 lines

  1. # Makefile for the GNU file utilities.
  2. # Copyright (C) 1986, 1988, 1989, 1990 Free Software Foundation, Inc.
  3.  
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 1, or (at your option)
  7. # any later version.
  8.  
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. SHELL = /bin/sh
  19. # If you use gcc, you should either run the fixincludes script that
  20. # comes with it or else use gcc with the -traditional option.  Otherwise
  21. # ioctl calls will be compiled incorrectly on some systems.
  22. CC = gcc
  23.  
  24. # Things you might add to CFLAGS:
  25. # -DSTDC_HEADERS    If you have ANSI C headers and libraries.
  26. # -D_POSIX_SOURCE    If you have POSIX.1 headers and libraries.
  27. # -DSIGTYPE=int        If your signal handlers return int, not void.
  28. # -DUSG            System V strings, headers, ndir.h.
  29. # -DDIRENT        If you have dirent.h.
  30. # -DSYSNDIR        Old Xenix systems (selects sys/ndir.h).
  31. # -DINT_16_BITS        On machines where sizeof long > sizeof int.
  32. # -DHPUX_NFS_BUG    On HP/UX (6.5 at least) where NFS files have
  33. #            reported blocksizes twice the correct size.
  34. # -DVPRINTF_MISSING    If you lack vprintf function (but have _doprnt).
  35. # -DMKDIR_MISSING    If you lack mkdir and rmdir system calls.
  36. # -DFCHMOD_MISSING    If you lack fchmod system call.
  37. # -DRENAME_MISSING    If you lack rename system call.
  38. # -DFTRUNCATE_MISSING    If you lack ftruncate system call.
  39. # -DSTBLOCKS_MISSING    If your `struct stat' lacks st_blocks and st_blksize.
  40.  
  41. # BSD
  42. CFLAGS = -g -DSIGTYPE=int -DVPRINTF_MISSING
  43. LIBS = $(LIBOBJS)
  44.  
  45. # SunOS 4.0
  46. #CFLAGS = -g -DDIRENT
  47. #LIBS = $(LIBOBJS)
  48.  
  49. # Typical System V
  50. #CFLAGS = -g -DUSG -DMKDIR_MISSING -DFCHMOD_MISSING \
  51. #    -DRENAME_MISSING -DSTBLOCKS_MISSING \
  52. #    -DFTRUNCATE_MISSING -DMV_DIR=\"$(LIBDIR)/mv_dir\"
  53. #LIBPROGS = mv_dir
  54. #LIBINSTALL = install_lib
  55. # Non-gcc users need -lPW to get alloca.
  56. #LIBS = $(LIBOBJS) -lndir #-lPW
  57.  
  58. # SCO Xenix 386
  59. # Recent versions have both sys/dir.h, linked with -lx,
  60. # and dirent.h, linked with -ldir.  In some versions, the -ldir
  61. # library is buggy.  But the -ldir routines are the only way to
  62. # access network drives.
  63. #CFLAGS = -g -DUSG -DMKDIR_MISSING -DFCHMOD_MISSING \
  64. #    -DRENAME_MISSING -DSTBLOCKS_MISSING \
  65. #    -Dftruncate=chsize -DSYSNDIR -DMV_DIR=\"$(LIBDIR)/mv_dir\"
  66. #LIBPROGS = mv_dir
  67. #LIBINSTALL = install_lib
  68. # Non-gcc users need to get alloca from somewhere, like emacs or bash,
  69. # and add alloca.o to LIBOBJS.
  70. #LIBS = $(LIBOBJS) -lx
  71.  
  72. # HP/UX
  73. #CFLAGS = -g -DUSG -DVPRINTF_MISSING
  74. #LIBS = $(LIBOBJS)
  75.  
  76. LDFLAGS = -g
  77.  
  78. LIBOBJS = getopt.o getopt1.o
  79.  
  80. # Where to install the executables.
  81. BINDIR = /usr/local/gnubin
  82. # Where to put mv_dir on systems lacking the rename system call.
  83. LIBDIR = /usr/local/lib
  84.  
  85. # Executable files in this directory.
  86. PROGS = cat chmod cmp cp create dd du ginstall head ln dir vdir ls \
  87.     mkdir mkfifo mv rm rmdir tac tail
  88.  
  89. # Version of fileutils release.
  90. VERSION = 1.3
  91.  
  92. # Files to include in the distribution archive.
  93. DISTFILES = COPYING ChangeLog Makefile README \
  94.     backupfile.c cat.c chmod.c cmp.c cp-aux.c cp-hash.c cp.c cp.h \
  95.     create.c dd.c dirlib.c du.c eaccess.c error.c filemode.c \
  96.     getopt.c getopt1.c glob.c head.c ln.c ls.c mkdir.c mkfifo.c \
  97.     modechange.c modechange.h mv.c mv_dir.c rm.c rmdir.c tail.c \
  98.     tac.c regex.c getversion.c argmatch.c fileblocks.c install.c \
  99.     savedir.c backupfile.h getopt.h system.h regex.h
  100.  
  101. # The name of the distribution archive.
  102. TARFILE = fileutils-$(VERSION).tar.Z
  103.  
  104. all: $(PROGS) $(LIBPROGS)
  105. .PHONY: all
  106.  
  107. $(PROGS) $(LIBPROGS):    $(LIBOBJS)
  108.  
  109. install:    all $(LIBINSTALL)
  110.     ginstall $(PROGS) $(BINDIR)
  111.     cd $(BINDIR); ln -f dir d; ln -f vdir v; mv ginstall install
  112. .PHONY: install
  113.  
  114. install_lib:    $(LIBPROGS)
  115.     ginstall $(LIBPROGS) $(LIBDIR)
  116.     cd $(LIBDIR); chown root $(LIBPROGS); chmod 4755 $(LIBPROGS)
  117. .PHONY: install_lib
  118.  
  119. # Linking rules.
  120.  
  121. cat: cat.o error.o
  122.     $(CC) $(LDFLAGS) -o $@ cat.o error.o $(LIBS)
  123.  
  124. chmod: chmod.o modechange.o filemode.o error.o savedir.o
  125.     $(CC) $(LDFLAGS) -o $@ chmod.o modechange.o filemode.o error.o \
  126.     savedir.o $(LIBS)
  127.  
  128. cmp: cmp.o error.o
  129.     $(CC) $(LDFLAGS) -o $@ cmp.o error.o $(LIBS)
  130.  
  131. cp: cp.o cp-hash.o cp-aux.o dirlib.o eaccess.o error.o backupfile.o \
  132.     getversion.o argmatch.o savedir.o
  133.     $(CC) $(LDFLAGS) -o $@ cp.o cp-hash.o cp-aux.o dirlib.o \
  134.     eaccess.o error.o backupfile.o getversion.o argmatch.o \
  135.     savedir.o $(LIBS)
  136.  
  137. create: create.o modechange.o dirlib.o error.o
  138.     $(CC) $(LDFLAGS) -o $@ create.o modechange.o dirlib.o error.o $(LIBS)
  139.  
  140. dd: dd.o error.o
  141.     $(CC) $(LDFLAGS) -o $@ dd.o error.o
  142.  
  143. dir: dir.o filemode.o glob.o error.o argmatch.o fileblocks.o
  144.     $(CC) $(LDFLAGS) -o $@ dir.o filemode.o glob.o error.o \
  145.     argmatch.o fileblocks.o $(LIBS)
  146.  
  147. du: du.o error.o fileblocks.o savedir.o
  148.     $(CC) $(LDFLAGS) -o $@ du.o error.o fileblocks.o savedir.o $(LIBS)
  149.  
  150. ginstall: install.o dirlib.o error.o
  151.     $(CC) $(LDFLAGS) -o $@ install.o dirlib.o error.o $(LIBS)
  152.  
  153. head: head.o error.o
  154.     $(CC) $(LDFLAGS) -o $@ head.o error.o $(LIBS)
  155.  
  156. ln: ln.o eaccess.o error.o backupfile.o getversion.o dirlib.o argmatch.o
  157.     $(CC) $(LDFLAGS) -o $@ ln.o eaccess.o error.o backupfile.o \
  158.     getversion.o dirlib.o argmatch.o $(LIBS)
  159.  
  160. ls: ls.o filemode.o glob.o error.o argmatch.o fileblocks.o
  161.     $(CC) $(LDFLAGS) -o $@ ls.o filemode.o glob.o error.o \
  162.     argmatch.o fileblocks.o $(LIBS)
  163.  
  164. mkdir: mkdir.o modechange.o dirlib.o error.o
  165.     $(CC) $(LDFLAGS) -o $@ mkdir.o modechange.o dirlib.o error.o $(LIBS)
  166.  
  167. mkfifo: mkfifo.o modechange.o dirlib.o error.o
  168.     $(CC) $(LDFLAGS) -o $@ mkfifo.o modechange.o dirlib.o error.o $(LIBS)
  169.  
  170. mv: mv.o eaccess.o error.o backupfile.o getversion.o dirlib.o argmatch.o
  171.     $(CC) $(LDFLAGS) -o $@ mv.o eaccess.o error.o backupfile.o \
  172.     getversion.o dirlib.o argmatch.o $(LIBS)
  173.  
  174. mv_dir: mv_dir.o error.o
  175.     $(CC) $(LDFLAGS) -o $@ mv_dir.o error.o
  176.  
  177. rm: rm.o dirlib.o eaccess.o error.o
  178.     $(CC) $(LDFLAGS) -o $@ rm.o dirlib.o eaccess.o error.o $(LIBS)
  179.  
  180. rmdir: rmdir.o dirlib.o error.o
  181.     $(CC) $(LDFLAGS) -o $@ rmdir.o dirlib.o error.o $(LIBS)
  182.  
  183. tac: tac.o error.o regex.o
  184.     $(CC) $(LDFLAGS) -o $@ tac.o error.o regex.o $(LIBS)
  185.  
  186. tail: tail.o error.o
  187.     $(CC) $(LDFLAGS) -o $@ tail.o error.o $(LIBS)
  188.  
  189. vdir: vdir.o filemode.o glob.o error.o argmatch.o fileblocks.o
  190.     $(CC) $(LDFLAGS) -o $@ vdir.o filemode.o glob.o error.o \
  191.     argmatch.o fileblocks.o $(LIBS)
  192.  
  193. # Compilation rules.
  194.  
  195. chmod.o create.o mkdir.o mkfifo.o modechange.o: modechange.h
  196.  
  197. cp.o mv.o ln.o backupfile.o getversion.o: backupfile.h
  198.  
  199. cp.o cp-hash.o cp-aux.o: cp.h
  200.  
  201. tac.o regex.o: regex.h
  202.  
  203. # C compilers that can't handle -c and -o together need the following:
  204. #dir.o:        ls.c
  205. #    $(CC) $(CFLAGS) -DMULTI_COL -c ls.c
  206. #    mv ls.o dir.o
  207. #
  208. #vdir.o:        ls.c
  209. #    $(CC) $(CFLAGS) -DLONG_FORMAT -c ls.c
  210. #    mv ls.o vdir.o
  211.  
  212. dir.o:        ls.c
  213.     $(CC) $(CFLAGS) -DMULTI_COL -o dir.o -c ls.c
  214.  
  215. vdir.o:        ls.c
  216.     $(CC) $(CFLAGS) -DLONG_FORMAT -o vdir.o -c ls.c
  217.  
  218. # Use /bin/rm instead of ./rm in case ./rm is compiled for a different
  219. # architecture.
  220. clean:
  221.     /bin/rm -f $(PROGS) $(LIBPROGS) *.o tags TAGS a.out core
  222. .PHONY: clean
  223.  
  224. dist:    $(TARFILE)
  225. .PHONY: dist
  226.  
  227. $(TARFILE):    $(DISTFILES)
  228.     rm -rf fileutils-$(VERSION)
  229.     mkdir fileutils-$(VERSION)
  230.     ln $(DISTFILES) fileutils-$(VERSION)
  231.     tar cohf - fileutils-$(VERSION) | compress > $(TARFILE)
  232.     rm -rf fileutils-$(VERSION)
  233.